<?php
session_start();
require_once("UserDao.php");

if ($_SESSION["code"] != $_POST['vcode']) {
	echo "valid_code_error";
	exit;
}

$dao = new UserDao();
$user = $dao->findByAccount($_POST['account']);
if ($user->getId() != "") {
	if ($user->getPasswd() == $_POST['passwd']) {
		echo "success";
		$_SESSION['sessuid'] = $user->getId();
		header('Location:kcb.php');
	} else {
		echo "passwd_is_error";
	}
} else {
	echo "account_is_not_exist";
}
?>